package com.ld.security.common.rocketmq.mq;

import com.ld.security.common.core.util.GenericUtil;
import lombok.Getter;

@Getter
public abstract class SuperMq<E> {

    private String producerGroup;

    private String topic;

    private String subExpression;


    public SuperMq(String producerGroup, String topic, String subExpression) {
        this.producerGroup = producerGroup;
        this.topic = topic;
        this.subExpression = subExpression;
    }

    public SuperMq(SuperMq mq) {
        this.producerGroup = mq.producerGroup;
        this.topic = mq.topic;
        this.subExpression = mq.subExpression;
    }


    /**
     * 消息处理
     * @param msg
     */
    public abstract void run(E msg);


    public Class<?> getEntityClass(){
        return GenericUtil.getGeneric(this.getClass(),SuperMq.class,0);
    }

}
